import React, { useState, useEffect, useRef } from 'react'
import { ImageUploader, Button } from 'antd-mobile'
import { observer } from 'mobx-react-lite' // 引入react和mobx的中间件
import useStore from '../../store'
import { serverurl } from '../../utils/request'
import { updateUserAPI } from '../../api'
import NavHeader from '../../components/NavHeader'
import './index.scss'

function UpdateUser() {
  const iptRef = useRef(null)
  const { userStore } = useStore()

  // const [avatar, setAvatar] = useState('')
  // const [nickname, setNickname] = useState('')

  useEffect(() => {
    userStore.loadUserInfo() // 获取用户信息
  }, [])

  const updateUserHandler = async () => {
    const { data: res } = await updateUserAPI({
      avatar: '',
      gender: '1',
      nickname: '',
      phone: '18866669999',
    })
    console.log('更新用户信息', res)
  }

  return (
    <div className="updateUser">
      <NavHeader title="个人资料修改"></NavHeader>
    </div>
  )
}

export default observer(UpdateUser)
